//****************************************************************************
// inputparmetersparser.h
// contains the declarations and defenitions of the InputParmetersParser
// class and it's successors.
//
// Author: Einat Zuker
//****************************************************************************
#ifndef INPUTPARAMETERSPARSER_H
#define INPUTPARAMETERSPARSER_H

#include <string>
#include <iostream>

using std::string;
using std::exception;


//****************************************************************************
// defines and constants
//****************************************************************************
#define LARGE_BUFFER_SIZE 256
#define SMALL_BUFFER_SIZE 64

/*****************************************************************************/
// InputParmetersParserExepetion
// implements the Input Parmeters Parser Exepetion interface
/*****************************************************************************/
class InputParmetersParserExepetion : public exception
{
private:
	string m_ErrorDescription;
	
public:
	InputParmetersParserExepetion(string description)
	{
		exception::exception();
		m_ErrorDescription = description;	
	}

	string GetErrorDescription()
	{
		return m_ErrorDescription;
	}
};

//****************************************************************************
// InputParmetersParser class
// A base class (pure virtual) to define the intrface of an Input Parmeters Parser
//****************************************************************************
class InputParmetersParser
{
public:
	InputParmetersParser(string fileName)
		: m_FileName(fileName) {};

	//general parameters
	virtual bool GetImprovedColoringOnly() = 0;

	//permutations parameters
	virtual int GetMinPermutationChainLength() = 0;
	virtual int GetIntersectionSize() = 0;
	virtual int GetChainNumber() = 0;
	virtual double GetPermutationPercent() = 0;

	//graphcoloring parameters
	virtual int GetNumberOfIterationsForGreedySearch() = 0;
	virtual int GetBreakingPercentage() = 0;
	virtual int GetBreakingIterationsGroupSize() = 0;
	virtual int GetDropPercent() = 0;
	virtual int GetMaxIndexForOptimizations() = 0;
	virtual int GetMaxIndexForImprovedGreedy() = 0;
	virtual int GetPercentOfVerticesToStartImprovedGreedy() = 0;
	virtual int GetPercentOfVerticesToStopImprovedGreedy() = 0;
	virtual int GetNumberOfPairsInImprovedGreedy() = 0;
	virtual int GetFastMode() = 0;
	virtual int GetDestinationChainSize() = 0;
	virtual int GetNumberOfIterationsForVertexSearch() = 0;
	virtual int GetNumberOfIterationsToFillPermutaionChain() = 0;

protected:
	string m_FileName; 
};

//****************************************************************************
// WinInputParmetersParser class
// A class specific for the windows platform that inheirts and implemnts
// the InputParmetersParser interface.
//****************************************************************************
class WinInputParmetersParser : public InputParmetersParser
{
public:

	WinInputParmetersParser(string fileName);

	//general parameters
	bool GetImprovedColoringOnly();

	//permutations parameters
	int GetMinPermutationChainLength();
	int GetIntersectionSize();
	int GetChainNumber();
	double GetPermutationPercent();

	//graphcoloring parameters
	int GetNumberOfIterationsForGreedySearch();
	int GetBreakingPercentage();
	int GetBreakingIterationsGroupSize();
	int GetDropPercent();
	int GetMaxIndexForOptimizations();
	int GetMaxIndexForImprovedGreedy();
	int GetPercentOfVerticesToStartImprovedGreedy();
	int GetPercentOfVerticesToStopImprovedGreedy();
	int GetNumberOfPairsInImprovedGreedy();
	int GetFastMode();
	int GetDestinationChainSize();
	int GetNumberOfIterationsForVertexSearch();
	int GetNumberOfIterationsToFillPermutaionChain();
};

//****************************************************************************
// OtherOsInputParmetersParser class
// A class specific for the some OS platform that inheirts and implemnts
// the InputParmetersParser interface.
// note: this class has an empty implamentaion for all the InputParmetersParser interface.
//****************************************************************************
class OtherOsInputParmetersParser : public InputParmetersParser
{
public:
	OtherOsInputParmetersParser(string fileName)
		: InputParmetersParser(fileName){}
	
	//general parameters
	bool GetImprovedColoringOnly()
		{throw("not implemnted"); return false;}

	//permutations parameters
	int GetMinPermutationChainLength()
		{throw("not implemnted"); return 0;}
	int GetIntersectionSize()
		{throw("not implemnted"); return 0;}
	int GetChainNumber()
		{throw("not implemnted"); return 0;}
	double GetPermutationPercent()
		{throw("not implemnted"); return 0;}

	//graphcoloring parameters
	int GetNumberOfIterationsForGreedySearch()
		{throw("not implemnted"); return 0;}
	int GetBreakingPercentage()
		{throw("not implemnted"); return 0;}
	int GetBreakingIterationsGroupSize()
		{throw("not implemnted"); return 0;}
	int GetDropPercent()
		{throw("not implemnted"); return 0;}
	int GetMaxIndexForOptimizations()
		{throw("not implemnted"); return 0;}
	int GetMaxIndexForImprovedGreedy()
		{throw("not implemnted"); return 0;}
	int GetPercentOfVerticesToStartImprovedGreedy()
		{throw("not implemnted"); return 0;}
	int GetPercentOfVerticesToStopImprovedGreedy()
		{throw("not implemnted"); return 0;}
	int GetNumberOfPairsInImprovedGreedy()
		{throw("not implemnted"); return 0;}
	int GetFastMode()
		{throw("not implemnted"); return 0;}
	int GetDestinationChainSize()
		{throw("not implemnted"); return 0;}
	int GetNumberOfIterationsForVertexSearch()
		{throw("not implemnted"); return 0;};
	int GetNumberOfIterationsToFillPermutaionChain()
		{throw("not implemnted"); return 0;};
};








#endif //INPUTPARAMETERSPARSER_H

